package cn.layku.service.order.controller;

import cn.layku.service.order.service.OrderService;
import cn.layku.service.order.util.ApiResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class OrderController {

    @Resource(name = "orderService")
    private OrderService orderService;

    /**
     * 创建订单
     */
    @PostMapping("/order/add")
    public ApiResult<Object> add(@RequestParam Map<String, Object> map) {
        int i = orderService.add(map);
        if (i > 0) {
            return ApiResult.successResult();
        }
        return ApiResult.failResult("创建订单失败");
    }

}
